Multiplier TWA calculation

The multiplier component uses a Time-Weighted Average (TWA) calculation to determine user holding levels for XRD, LSUs, and other whitelisted derivatives. This ensures fair multiplier allocation based on actual holding duration.

Time-Weighted Average (TWA) Calculation

TWA = (∑(balance_i × time_interval_i)) ÷ total_time

Where:

Flow Diagram

flowchart TD Start[Record initial balance and timestamp] --> B[Transaction stream] B --> C{Balance change?} C -->|No| D{End of period?} D -->|No| B D -->|Yes| E[Calculate time-weighted average] C -->|Yes| I[Record updated balance and timestamp] E --> N[End]

Examples

Example 1: Consistent Balance

If an account maintains 10,000 XRD for the entire 7-day period:

Example 2: Balance Increase

If an account starts with 5,000 XRD for 1 day, then increases to 10,000 XRD for the remaining 6 days:

Example 3: Temporary Zero Balance

If an account holds 10,000 XRD for 3 days, then 0 XRD for 3 days, then 10,000 XRD for 1 day:

Example 4: Last-Minute Balance

If an account holds 0 XRD for 6 days and only adds 10,000 XRD on the last day:

Implementation

The TWA calculation ensures that: